package com.chuji.crmcj.act;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;

import com.chuji.crmcj.R;
import com.chuji.crmcj.adapter.ListViewAdapter;

public class BuyBudgetActivity extends Activity {
    //返回
    private ImageView mIv_Back;
    //显示
    private ListView lv_checkBox;
    //获取用户输入
    private EditText et_start;
    private EditText et_end;
    //适配器
    ListViewAdapter adapter;
    //请求码
    private int resultCode = 4;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_buy_budget);
        //初始化组件
        mIv_Back = (ImageView) findViewById(R.id.iv_back);
        et_start= (EditText)findViewById(R.id.et_start);
        et_end= (EditText)findViewById(R.id.et_end);
        // this.finish();
        mIv_Back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //获取用户输入
                String start=et_start.getText().toString();
                String end=et_end.getText().toString();
                if(start==null&&end==null){
                    //传值，返回数据
                    Intent mIntent = new Intent();
                    mIntent.putExtra("start"," ");
                    mIntent.putExtra("end", " ");
                    // 设置结果，并进行传送
                    setResult(resultCode, mIntent);
                }else {
                    //传值，返回数据
                    Intent mIntent = new Intent();
                    mIntent.putExtra("start", start);
                    mIntent.putExtra("end", end);
                    // 设置结果，并进行传送
                    setResult(resultCode, mIntent);
                }
                finish();
            }
        });
    }
    //屏蔽系统返回键
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) { //监控/拦截/屏蔽返回键

        }
        return false;
    }
}
